Apparatus and method for foreground detection

ABSTRACT

An apparatus and a method for fast foreground detection are provided. A foreground characteristic value calculation module calculates a foreground characteristic value by using an image intensity of each pixel in a target image and a background intensity of a corresponding pixel in a background model. A first filter determines a first threshold and a second threshold according to at least one scenic factor for capturing the target image and filters out non-foreground pixels having their foreground characteristic value between the first threshold and the second threshold from pixels in the target image. A second filter determines an image difference condition and a chroma similarity condition according to the scenic factor and filters out non-foreground pixels having their foreground characteristic value satisfying the image difference condition and the chroma similarity condition from pixels left by the first filter. Pixels left by the second filter are served as foreground pixels.

CROSS-REFERENCE TO RELATED APPLICATION

This application claims the priority benefit of Taiwan applicationserial no. 100143591, filed on Nov. 28, 2011. The entirety of theabove-mentioned patent application is hereby incorporated by referenceherein and made a part of specification.

TECHNICAL FIELD

The disclosure relates to an apparatus and a method for detectingforegrounds in surveillance images.

BACKGROUND

Video surveillance is broadly applied in our daily life. When thousandsof video cameras are deployed at every corner of a city and sendcaptured images back to back-end control stations, image management andrecognition becomes an arduous back-end task. Besides accomplishing thesecurity purpose through manual monitoring, video surveillance may alsobe realized through intelligent video object detection. The stability ofsuch a function directly affects the willingness of consumers to theacceptance of intelligent video cameras.

One of factors in the stability of intelligent video object detection isfast and accurate foreground detection. In a surveillance application, aforeground usually refers to a person, vehicle, or any other movingobject on the scene. Accurate foreground detection can be applied invarious surveillance applications, such as human tracking, humancounting, and intrusion detection of virtual caution zone. Without agood foreground detection technique, aforementioned applications won'tbe able to provide satisfactory or commercializable result. Thus,accurate foreground detection is one of the most critical techniques.

In general foreground separation techniques, an image intensitybackground model is first established, and the foreground is thenseparated according to the difference between the foreground and thebackground. The most commonly adopted technique is to establish abackground intensity Gaussian model for each pixel. In recent years, atechnique of separating foreground by manually setting thresholds ofintensity and color vector difference θ is provided. Compared to atechnique in which the foreground is separated based on intensitydifference, this technique provides a more accurate result since onemore factor is taken into consideration. However, because the colorvector difference θ is further calculated regarding each pixel besidesthe intensity of the pixel, the operation load is greatly increased. Asa result, the implementation on an embedded platform is made verycomplicated.

High accuracy results in high operation load, and high operation loadrequires high-priced processor, which is concerned to a commercialproduct because the cost of the product will be increased. In somecases, even the high level processor cannot accomplish the highoperation load brought by the complicated calculation algorithm.

SUMMARY

An apparatus and a method for foreground detection are introducedherein, in which foreground pixel filters are adjusted according to thecontext so that foreground detection with high accuracy and lowoperation load is realized.

The disclosure provides a foreground detection apparatus including aforeground characteristic value calculation module, a first filter, anda second filter. The foreground characteristic value calculation modulecalculates a foreground characteristic value by using an image intensityof each of a plurality of pixels in a target image and a backgroundintensity of a corresponding pixel in a background model. The firstfilter determines a first threshold and a second threshold according toat least one scenic factor for capturing the target image and filtersout a plurality of non-foreground pixels having a correspondingforeground characteristic value between the first threshold and thesecond threshold from the pixels in the target image. The second filterdetermines an image difference condition and a chroma similaritycondition according to the scenic factor for capturing the target image,filters out non-foreground pixels having the corresponding foregroundcharacteristic value satisfying the image difference condition and thechroma similarity condition from the pixels left by the first filter,and serves the remaining pixels as a plurality of foreground pixels.

The disclosure provides a foreground detection method adapted to anelectronic apparatus for detecting a plurality of foreground pixels in atarget image. In the foreground detection method, a foregroundcharacteristic value is calculated by using an image intensity of eachof a plurality of pixels in a target image and a background intensity ofa corresponding pixel in a background model. Then, a first threshold anda second threshold are determined according to at least one scenicfactor for capturing the target image, and a plurality of non-foregroundpixels having the corresponding foreground characteristic value betweenthe first threshold and the second threshold is filtered out from thepixels in the target image. Next, an image difference condition and achroma similarity condition are determined according to the scenicfactor for capturing the target image, and non-foreground pixels havingthe corresponding foreground characteristic value satisfying the imagedifference condition and the chroma similarity condition are filteredout from a plurality of pixels left by the first filter. The remainingpixels are served as a plurality of foreground pixels.

As described above, the disclosure provides an apparatus and a methodfor foreground detection, in which most non-foreground pixels are firstfiltered out, and the rest non-foreground pixels are then filtered outrespectively according to image intensity difference and chromasimilarity, so that foreground pixels in a surveillance image can bequickly and accurately detected.

Several exemplary embodiments accompanied with figures are described indetail below to further describe the disclosure in details.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings are included to provide further understanding,and are incorporated in and constitute a part of this specification. Thedrawings illustrate exemplary embodiments and, together with thedescription, serve to explain the principles of the disclosure.

FIG. 1 is a diagram of a surveillance system according to an exemplaryembodiment of the disclosure.

FIG. 2 is a block diagram of a foreground detection apparatus accordingto an exemplary embodiment of the disclosure.

FIG. 3 is a flowchart of a foreground detection method according to anexemplary embodiment of the disclosure.

FIG. 4 is a block diagram of a foreground characteristic valuecalculation module according to an exemplary embodiment of thedisclosure.

FIG. 5 is a block diagram of a second filter according to an exemplaryembodiment of the disclosure.

FIG. 6 is a flowchart of a foreground detection method according to anexemplary embodiment of the disclosure.

FIGS. 7A-7D illustrate an example of a foreground detection methodaccording to an exemplary embodiment of the disclosure.

DETAILED DESCRIPTION OF DISCLOSED EMBODIMENTS

In the following detailed description, for purposes of explanation,numerous specific details are set forth in order to provide a thoroughunderstanding of the disclosed embodiments. It will be apparent,however, that one or more embodiments may be practiced without thesespecific details. In other instances, well-known structures and devicesare schematically shown in order to simplify the drawing.

If nobody appears in a scene under surveillance most of the time, theimages captured by a surveillance video camera usually contain thebackground. In this case, the foreground detected by the surveillancesystem is very close to the background. Based on this characteristic,the disclosure provides a pre-filter for roughly filtering out thesimilar parts of the foreground and the background in a surveillanceimage before foreground detection is performed, such that the operationload, and accordingly the hardware cost, of a surveillance system forforeground detection can be greatly reduced.

FIG. 1 is a diagram of a surveillance system according to an exemplaryembodiment of the disclosure. Referring to FIG. 1, the surveillancesystem in the present exemplary embodiment includes a surveillance videocamera 11 and a surveillance host 12. The surveillance video camera 11may be a video camera deployed in a scene under surveillance. Thesurveillance video camera 11 captures surveillance images and sendsthese images to the surveillance host 12 through a network or any otherwired or wireless technique. The surveillance host 12 displays andanalyzes these surveillance images. The surveillance host 12 is anoperational electronic device, such as a personal computer (PC) or asetup box. The surveillance host 12 includes a foreground detectionapparatus 122 and an analysis and processing device 124 which supportsvarious advanced image processing functions. When the surveillance host12 executes a surveillance function, the foreground detection apparatus122 first performs foreground detection on a target image input by thesurveillance video camera 11 and provides the detected foregroundinformation to the analysis and processing device 124, and the analysisand processing device 124 then performs subsequent image processing,analysis, and warning functions.

FIG. 2 is a block diagram of a foreground detection apparatus accordingto an exemplary embodiment of the disclosure. FIG. 3 is a flowchart of aforeground detection method according to an exemplary embodiment of thedisclosure. Referring to both FIG. 2 and FIG. 3, the foregrounddetection apparatus 20 in the present exemplary embodiment may be theforeground detection apparatus 122 in foregoing exemplary embodiment.The foreground detection apparatus 20 includes a foregroundcharacteristic value calculation module 22, a first filter 24, and asecond filter 26. Below, the foreground detection method in the presentexemplary embodiment will be described in detail with reference to thedevices illustrated in FIG. 2.

First, the foreground characteristic value calculation module 22calculates a foreground characteristic value by using the imageintensity of each pixel in a target image and the background intensityof the corresponding pixel in a background model (step S302). Theforeground characteristic value calculation module 22 may establish thebackground model by using a pre-recorded test video or an image input bythe surveillance video camera such that foreground detection can beperformed on subsequently captured surveillance images.

FIG. 4 is a block diagram of a foreground characteristic valuecalculation module according to an exemplary embodiment of thedisclosure. Referring to FIG. 4, the foreground characteristic valuecalculation module 22 includes a background intensity calculation unit222, an image intensity calculation unit 224, and an intensityproportion calculation unit 226. The background intensity calculationunit 222 receives a plurality of background images and calculates abackground intensity of each pixel in the background images to establisha background model. The image intensity calculation unit 224 receives atarget image and calculates an image intensity of each pixel in thetarget image. The intensity proportion calculation unit 226 calculatesan intensity proportion of the image intensity of each pixel to thebackground intensity of the corresponding pixel in the background modeland serves the intensity proportions as foreground characteristicvalues.

The present exemplary embodiment provides three different measurementsregarding aforementioned background intensity and image intensity.

As to the first measurement, the background intensity calculation unit222 directly serves the grayscale value of each pixel in a backgroundimage as the background intensity of the pixel, and the image intensitycalculation unit 224 directly serves the grayscale value of each pixelin a target image as the image intensity of the pixel.

As to the second measurement, the background intensity calculation unit222 calculates an average value of pixel values of each pixel in abackground image in a plurality of color spaces (for example, R, G, B orY, Cr, Cb) and serves the average value as the background intensity ofthe pixel, and the image intensity calculation unit 224 calculates anaverage value of pixel values of each pixel in a target image in aplurality of color spaces and serves the average value as the imageintensity of the pixel.

As to the third measurement, the background intensity calculation unit222 calculates a root sum of squares of pixel values of each pixel in abackground image in a plurality of color spaces and serves the root sumof squares as the background intensity of the pixel, and the imageintensity calculation unit 224 calculates a root sum of squares of pixelvalues of each pixel in a target image in a plurality of color spacesand serves the root sum of squares as the image intensity of the pixel.

For example, m (m is a positive integer) background images are used forestablishing a background model, and an average pixel value Ī_(i) ofeach pixel in these background images in a plurality of color spaces iscalculated:

$\begin{matrix}{{\overset{\_}{I}}_{i} = \frac{\sum\limits_{i = 1}^{m}{I_{i}(t)}}{m}} & (1)\end{matrix}$

In foregoing expression (1), pixel information is indicated by thesymbol I={I_(i)|i=1, 2, 3}, wherein I_(i) may be any information in thecolor space R, G, B or the color space Y, Cr, Cb. For the convenience ofdescription, the image intensity and the background intensity of eachpixel in an input image are respectively indicated by the symbols |I|and |B|.

Taking the image intensity |I| as an example, foregoing three differentdefinitions of image intensity can be respectively expressed as:

First measurement:

|I|=I _(i)  (2)

In foregoing expression (2), I_(i) may be a grayscale value Y in thecolor space Y, Cr, Cb or any information in the color space R, G, B orY, Cr, Cb.

Second measurement:

|I|=(I ₁ +I ₂ +I ₃)/3  (3)

In foregoing expression (3), I₁, I₂, and I₃ respectively represent pixelvalues in the color space R, G, B or Y, Cr, Cb.

Third measurement:

|I|=√{square root over (I ₁ ² +I ₂ ² +I ₃ ²)}  (4)

In foregoing expression (4), I₁, I₂, and I₃ respectively represent pixelvalues in the color space R, G, B or Y, Cr, Cb.

Definitions of the background intensity |B| of each pixel in backgroundimages can be deduced from foregoing expressions. In the presentexemplary embodiment, the intensity proportion r is calculated by usingfollowing formula after the image intensity |I| and the backgroundintensity |B| are obtained:

$\begin{matrix}{r = \frac{I}{B}} & (5)\end{matrix}$

In foregoing expression (5), |I|=|B| and r=1 if a target image isexactly the same as a background image.

Referring to FIG. 3 again, in the present exemplary embodiment, afterthe foreground characteristic values are obtained, the first filter 24filters out most non-foreground pixels in the target image. Herein thefirst filter 24 determines a first threshold and a second thresholdaccording to at least one scenic factor used by the surveillance videocamera for capturing the target image and filters out a plurality ofnon-foreground pixels among the pixels in the target image, wherein theforeground characteristic values corresponding to these non-foregroundpixels are between the first threshold and the second threshold (stepS304). Aforementioned scenic factor may be the average traffic ofpedestrians and vehicles, the size of an object appearing in the scene,or any other scenic variation. In addition, the first threshold and thesecond threshold may be two end values located at both sides of 1 andhaving their differences to 1 no more than a predetermined value, suchas 0.95 and 1.05.

Eventually, the second filter 26 determines an image differencecondition and a chroma similarity condition according to the scenicfactor for capturing the target image, filters out non-foreground pixelswhich have the corresponding foreground characteristic value satisfyingthe image difference condition and the chroma similarity condition amongthe remaining pixels left by the first filter 24, and serves theremaining pixels as a plurality of foreground pixels (step S306).

FIG. 5 is a block diagram of a second filter according to an exemplaryembodiment of the disclosure. Referring to FIG. 5, the second filter 26includes a foreground filter 262 and a background chroma filter 264. Theforeground filter 262 determines pixels having their correspondingforeground characteristic value greater than a third threshold of theimage difference condition or smaller than a fourth threshold of theimage difference condition among the remaining pixels left by the firstfilter 24 as foreground pixels. The background chroma filter 264calculates a chroma difference of each pixel in the target image anddetermines pixels having their chroma differences greater than a fifththreshold of the chroma similarity condition or smaller than a sixththreshold of the chroma similarity condition among the remaining pixelsas foreground pixels.

FIG. 6 is a flowchart of a foreground detection method according to anexemplary embodiment of the disclosure. Referring to FIG. 6, in thepresent exemplary embodiment, the pixels in an entire target image areindicated as I_(C)={I_(c1), I_(c2), I_(c3)}, wherein C represents asuperset, c1, c2, and c3 respectively represent a subset thereof, I_(c1)represents a set of non-foreground pixels filtered out by the firstfilter, I_(c2) represents a set of non-foreground pixels determined bythe second filter, and I_(c3) represents a set of pixels that areeventually determined to be foreground pixels. The first threshold T₁and the second threshold T₂ are defined according to environmentalparticularity or past experience and satisfy following relationalexpression:

T ₁<1<T ₂  (6)

Same as described in foregoing exemplary embodiment, in the foregrounddetection method provided by the present exemplary embodiment, theforeground characteristic value calculation module 22 first calculates aforeground characteristic value by using the image intensity of eachpixel in a target image and the background intensity of a correspondingpixel in a background model (step S602). Regarding the intensityproportion r of a specific pixel in the target image calculated by theforeground characteristic value calculation module 22, the first filter24 determines whether it is between the first threshold T₁ and thesecond threshold T₂ (step S604). Namely, the first filter 24 determineswhether the intensity proportion r satisfies following relationalexpression (7):

T ₁ ≦r≦T ₂  (7)

If the intensity proportion r satisfies foregoing expression (7), thefirst filter 24 directly determines the pixel as a non-foreground pixel(step S606). Otherwise, if the intensity proportion r does not satisfyforegoing expression (7), the pixel enters the second filter 26. Becausethe intensity proportion r is calculated in foregoing steps, theoperation load is very low and most non-foreground pixels I_(c1) arefiltered out by the first filter 24. Eventually, {I_(c2), I_(c3)} isleft.

In the second filter 26, the non-foreground pixels I_(c2) are filteredout by a foreground filter and a background chroma filter. Theforeground filter defines thresholds (for example, T₃ and T₄) of theintensity proportion r according to scenic particularity or pastexperience. The range defined by the thresholds may or may not containthe range defined by foregoing expression (6), and T₃>T₄. The foregroundfilter compares the intensity proportion r with the thresholds T₃ and T₄(step S608) to determine whether the intensity proportion r of any pixelin {I_(c2), I_(c3)} satisfies following expression:

r>T ₃  (8)

or

r<T ₄  (9)

If the intensity proportion r satisfies foregoing expression, the pixelis directly determined and output as a foreground pixel (step S614) andconsidered an element of the set I_(c3). Contrarily, whether the pixelis a foreground pixel or a non-foreground pixel cannot be determinedtherefore is further passed to the background chroma filter. Beforeentering the background chroma filter, a chroma difference θ betweeneach pixel in the target image and the corresponding pixel in thebackground model has to be calculated (step S610). The chroma differenceθ is defined as:

$\begin{matrix}{{\theta \left( {x,y} \right)} = {\cos^{- 1}\left( \frac{I \cdot B}{{I}{B}} \right)}} & (10)\end{matrix}$

The background chroma filter can determine whether a pixel is anon-foreground pixel by directly using the chroma difference θ, or tosimplify the calculation, using cos θ, which is not limited in thepresent exemplary embodiment. Herein two thresholds T₅ and T₆ of thechroma difference θ are defined according to scenic particularity orpast experience. Regarding each pixel which does not satisfy thefiltering conditions of the foreground filter, the background chromafilter compares the chroma difference θ thereof with the thresholds T₅and T₆ (step S612) to determine whether the chroma difference θsatisfies following expression:

θ>T ₅  (11)

or

θ<T ₆  (12)

If the chroma difference θ satisfies foregoing expression, the pixel isdetermined and output as a non-foreground pixel (step S606) and placedinto the set I_(c2). Contrarily, the pixel is determined and output as aforeground pixel (step S614) and considered as an element of the setI_(c3).

Another exemplary embodiment of the foreground detection methoddescribed above is further described below, in which actual data isbrought into foregoing expressions. First, a video recorded on aspecific scene is input into a foreground detection apparatus, or avideo camera is directly attached to the foreground detection apparatusfor receiving a real-time image stream. Then, m initial images arecollected to establish a background model (m is a positive integer),wherein an average pixel value of each pixel in different color spacesis calculated by using foregoing formula (1).

Next, the image intensity of each pixel in a target image is calculatedby using foregoing formula (2), (3), or (4). After that, the intensityproportion r of the image intensity of each pixel in the target image tothe background intensity of the corresponding pixel in the backgroundmodel is calculated by using foregoing formula (5), wherein r=1 when thetarget image is a background image.

FIGS. 7A-7D illustrate an example of a foreground detection methodaccording to an exemplary embodiment of the disclosure. In the presentexemplary embodiment, 6 pixels evenly distributed around a foregroundobject 70 are taken as examples, and the positions of these pixels in animage are as illustrated in FIG. 7A. The intensity proportions r ofthese pixels are as shown in following table 1.

TABLE 1 Pixel P1 P2 P3 P4 P5 P6 r 0.98 0.82 1.32 0.97 1.04 1.02

Then, two thresholds close to 1 are set in a first filter (for example,thresholds T₁=0.95 and T₂=1.05). Next, the intensity proportions r ofthe 6 pixels P1-P6 are filtered by the first filter (i.e., by foregoingexpression (7)). If the intensity proportion r of a pixel satisfiesforegoing expression (7), the pixel is determined to be a non-foregroundpixel. Otherwise, the pixel is sent to a second filter to be furtherprocessed.

Through the processing of the first filter, as shown in FIG. 7B, thepixels P1, P4, P5, and P6 are determined to be non-foreground pixels,and the pixels P2 and P3 are sent to the second filter since they don'tsatisfy the expression (7). Thereby, the filtering mechanism of thefirst filter can filter out most pixels by calculating the intensityproportions r but not the chroma differences θ, so that the operationload is reduced.

Thereafter, two or more thresholds of intensity proportion r are set ina foreground filter. The range defined by these thresholds may containthe range defined by foregoing expression (6). In the present exemplaryembodiment, two thresholds T₃ and T₄ are set. The settings of thesethresholds may be affected by scenic factors. The scenic factors includedifferent light distributions and intensities caused by differentweather conditions or different scenic materials. For example, anoutdoor road surface is not reflective, while an indoor marble floor isreflective, which result in different optimal settings of thethresholds. If an outdoor road and typical sunny weather are considered,the experiential thresholds are respectively T₃=1.2 and T₄=0.8. If abright indoor site with stable illumination is considered, theexperiential thresholds are respectively T₃=1.1 and T₄=0.7. If a darkindoor site with stable illumination is considered, the experientialthresholds are respectively T₃=1.3 and T₄=0.5.

In the present exemplary embodiment, whether the pixels P2 and P3 leftby the first filter are foreground pixels is determined according totheir intensity proportions r through foregoing expressions (8) and (9).If one of the two expressions is satisfied, the pixels P2 and P3 aredetermined to be foreground pixels. Otherwise, these two pixels arefurther sent to a background chroma filter. As shown in FIG. 7C, theintensity proportion r of the pixel P3 is 1.32 and which is greater thanT₃. Thus, the pixel P3 is determined to be a foreground pixel.Contrarily, because the intensity proportion r of the pixel P2 is 0.82and which does not satisfy foregoing expression (8) or (9), the pixel P2has to be sent to the background chroma filter to be further processed.

Finally, the chroma difference θ between the input pixel P2 and abackground pixel at the same position is calculated to be 0.9 by usingforegoing expression (10). As shown in FIG. 7D, the thresholds set bythe background chroma filter are T₅=0.94 and T₆=1. Because the chromadifference 0.9 corresponding to the pixel P2 does not satisfy theexpression (10), the pixel P2 is eventually determined to be aforeground pixel.

As described above, the disclosure provides an apparatus and a methodfor foreground detection, in which a pre-filter is adopted for roughlyfiltering out the similar parts of the foreground and the background ina surveillance image before foreground detection is performed, such thatthe operation load of a surveillance system for foreground detection canbe greatly reduced. By adopting a foreground filter and a backgroundchroma filter, foreground pixels and non-foreground pixels can befurther distinguished. Thereby, foreground detection with high accuracyand low operation load is realized by the technique provided by thedisclosure.

It will be apparent to those skilled in the art that variousmodifications and variations can be made to the structure of thedisclosed embodiments without departing from the scope or spirit of thedisclosure. In view of the foregoing, it is intended that the disclosurecover modifications and variations of this disclosure provided they fallwithin the scope of the following claims and their equivalents.

What is claimed is:
 1. A foreground detection apparatus, comprising: aforeground characteristic value calculation module, calculating aforeground characteristic value by using an image intensity of each of aplurality of pixels in a target image and a background intensity of acorresponding pixel in a background model; a first filter, determining afirst threshold and a second threshold according to at least one scenicfactor for capturing the target image, and filtering out a plurality ofnon-foreground pixels having a corresponding foreground characteristicvalue between the first threshold and the second threshold from pixelsin the target image; and a second filter, determining an imagedifference condition and a chroma similarity condition according to theat least one scenic factor for capturing the target image, filtering outthe plurality of non-foreground pixels having the correspondingforeground characteristic value satisfying the image differencecondition and the chroma similarity condition from the pixels left bythe first filter, and serving remaining pixels as a plurality offoreground pixels.
 2. The foreground detection apparatus according toclaim 1, wherein the foreground characteristic value calculation modulecomprises: a background intensity calculation unit, receiving aplurality of background images, and calculating the background intensityof each pixel in the background images to establish the backgroundmodel; an image intensity calculation unit, receiving the target image,and calculating the image intensity of each of the pixels in the targetimage; and an intensity proportion calculation unit, calculating anintensity proportion of the image intensity of each of the pixels to thebackground intensity of the corresponding pixel in the background modeland serving the intensity proportion as the foreground characteristicvalue.
 3. The foreground detection apparatus according to claim 2,wherein the background intensity calculation unit serves a grayscalevalue of each pixel in the background images as the background intensityof the pixel, and the image intensity calculation unit serves thegrayscale value of each of the pixels in the target image as the imageintensity of the pixel.
 4. The foreground detection apparatus accordingto claim 2, wherein the background intensity calculation unit calculatesan average value of pixel values of each pixel in the background imagesin a plurality of color spaces and serves the average value as thebackground intensity of the pixel, and the image intensity calculationunit calculates the average value of pixel values of each of the pixelsin the target image in the color spaces and the average value of pixelvalues as the image intensity of the pixel.
 5. The foreground detectionapparatus according to claim 2, wherein the background intensitycalculation unit calculates a root sum of squares of pixel values ofeach pixel in the background images in a plurality of color spaces andserves the root sum of squares as the background intensity of the pixel,and the image intensity calculation unit calculates the root sum ofsquares of pixel values of each of the pixels in the target image in thecolor spaces and serves the root sum of squares as the image intensityof the pixel.
 6. The foreground detection apparatus according to claim1, wherein the second filter comprises: a foreground filter, determiningpixels having the corresponding foreground characteristic value greaterthan a third threshold of the image difference condition or smaller thana fourth threshold of the image difference condition among the pixelsleft by the first filter to be foreground pixels; and a backgroundchroma filter, calculating a chroma difference between each of thepixels in the target image and the corresponding pixel in the backgroundmodel, and determining the pixels having the chroma difference greaterthan a fifth threshold of the chroma similarity condition or smallerthan a sixth threshold of the chroma similarity condition to be theforeground pixels.
 7. The foreground detection apparatus according toclaim 1, wherein the first threshold and the second threshold are twoend values located at both sides of 1, and differences of the firstthreshold and the second threshold to 1 are not greater than apredetermined value.
 8. A foreground detection method, adapted to anelectronic apparatus for detecting a plurality of foreground pixels in atarget image, the foreground detection method comprising: calculating aforeground characteristic value by using an image intensity of each of aplurality of pixels in the target image and a background intensity of acorresponding pixel in a background model; determining a first thresholdand a second threshold according to at least one scenic factor forcapturing the target image, and filtering out a plurality ofnon-foreground pixels having a corresponding foreground characteristicvalue between the first threshold and the second threshold from pixelsin the target image; and determining an image difference condition and achroma similarity condition according to the scenic factor for capturingthe target image, filtering out the plurality of non-foreground pixelshaving the corresponding foreground characteristic value satisfying theimage difference condition and the chroma similarity condition from thepixels left by a first filter, and serving remaining pixels as theplurality of foreground pixels.
 9. The foreground detection methodaccording to claim 8, wherein the step of calculating the foregroundcharacteristic value by using the image intensity of each of the pixelsin the target image and the background intensity of the correspondingpixel in the background model comprises: receiving a plurality ofbackground images, and calculating the background intensity of eachpixel in the background images to establish the background model;receiving the target image, and calculating the image intensity of eachof the pixels in the target image; and calculating an intensityproportion of the image intensity of each of the pixels to thebackground intensity of the corresponding pixel in the background modeland serving the intensity proportion as the foreground characteristicvalue.
 10. The foreground detection method according to claim 9, whereinthe step of calculating the background intensity of each pixel in thebackground images to establish the background model comprises:calculating an average value or a root sum of squares of pixel values ofeach pixel in the background images in a plurality of color spaces andserving the average value or the root sum of squares as the imageintensity of the pixel, or serving a grayscale value of each pixel inthe background images as the image intensity of the pixel.
 11. Theforeground detection method according to claim 9, wherein the step ofcalculating the image intensity of each of the pixels in the targetimage comprises: calculating an average value or a root sum of squaresof pixel values of each of the pixels in the target image in a pluralityof color spaces and serving the average value or the root sum of squaresas the image intensity of the pixel, or serving a grayscale value ofeach of the pixels in the target image as the image intensity of thepixel.
 12. The foreground detection method according to claim 9, whereinthe step of filtering out non-foreground pixels having the correspondingforeground characteristic value satisfying the image differencecondition and the chroma similarity condition from the pixels left bythe first filter and serving remaining pixels as foreground pixelscomprises: determining pixels having the corresponding foregroundcharacteristic value greater than a third threshold of the imagedifference condition or smaller than a fourth threshold of the imagedifference condition among the pixels left by the first filter to be theforeground pixels; and calculating a chroma difference between each ofthe pixels in the target image and the corresponding pixel in thebackground model, and determining the pixels having the chromadifferences greater than a fifth threshold of the chroma similaritycondition or smaller than a sixth threshold of the chroma similaritycondition to be the foreground pixels.
 13. The foreground detectionmethod according to claim 9, wherein the first threshold and the secondthreshold are two end values located at both sides of 1, and differencesof the first threshold and the second threshold to 1 are not greaterthan a predetermined value.